import java.util.Collection;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;



@SuppressWarnings("serial")
public class Main 
{
	public static void main(String[] args)  
    {
		  
	
    	EntityManager em = Persistence.createEntityManagerFactory("Thang").createEntityManager();
        EntityTransaction t = em.getTransaction();
        Query q = em.createQuery("select t from Nhanvien t");
		List<Nhanvien> nhanvienList = q.getResultList();
		for (Nhanvien nhanvien : nhanvienList) {
			System.out.println(nhanvien.getMsnv()+" "+nhanvien.getHoten()+" "+nhanvien.getDiachi());
			System.out.println("\n");
		}
		System.out.println("Size: " + nhanvienList.size());

       
        t.commit();
        em.close();
        System.exit(0);
    }
    
   
}
 


